package com.qf.factory;

import java.util.Properties;

public class MyBeanFactory {
    private Properties properties=new Properties();

    public MyBeanFactory() {
    }

    public MyBeanFactory(String config) throws Exception {
        properties.load(MyBeanFactory.class.getResourceAsStream(config));
    }
    public Object getBean(String beanName) throws Exception {
        String property = properties.getProperty(beanName);
        if (property!=null){
            Class clazz = Class.forName(property);
            return clazz.newInstance();
        }
        return null;
    }
}
